$(function () {
    //调用server加载首页新闻
    loadJobInfo();
});
let recruitmentList;
function loadJobInfo(){
    $.server({ }, '/website/v1/company/job').then(function (res) {
        $(".address").text(res.result.address);
        $(".companyName").text(res.result.companyName);
        $(".csTelephone").text(res.result.csTelephone);
        $(".email").text(res.result.email);
        $(".postcode").text(res.result.postcode);
        $(".website").text(res.result.website);
        var roleBoxhtml='',recruitment=res.result.recruitment;
        recruitmentList=recruitment;
        for(var i=0;i<recruitment.length;i++){
            if(i==0){
                roleBoxhtml+='<div class="role active" data-value="'+i+'">'+ recruitment[i].jobName +'</div>'
            }else{
                roleBoxhtml+='<div class="role" data-value="'+i+'">'+ recruitment[i].jobName +'</div>'
            } 
        } 
        $(".roleBox").html(roleBoxhtml);
        $(".roleInfoText").html(recruitmentList[0].jobDettail);
        $(".role").click(function(e){
            var index=e.currentTarget.dataset.value;
            $(".role").removeClass("active");
            $(this).addClass("active"); 
            $(".roleInfoText").html(recruitmentList[index].jobDettail);
        })
    });
}